Skip to content

Add display rendering, time-stepped inputs, and pin bit-width policy refactor#59

Merged
chelproc merged 4 commits into
mainfrom
20260411
May 23, 2026
Merged

Add display rendering, time-stepped inputs, and pin bit-width policy refactor#59
chelproc merged 4 commits into
mainfrom
20260411

Conversation

@chelproc
Copy link
Copy Markdown
Contributor

@chelproc chelproc commented Apr 11, 2026

This PR bundles several related improvements to the editor and simulation:

Display node now renders simulation output

  • CCComponentEditorRendererNodeDisplayRenderer reads the value of the Pixels input pin in play mode and paints each cell black/white accordingly, instead of always rendering an empty grid.

Time-stepped input values

  • InputValueKey is now [CCComponentPinId, TimeStep] instead of just CCComponentPinId, so manually-set input values are tracked per time step.
  • getInputValue falls back to the previous time step's value when none is set for the current step, keeping inputs sticky as time advances.
  • Callers (ComponentPin renderer, simulation harness) are updated to pass the current timeStep.

Pin bit-width policy refactor

  • Introduced IntrinsicComponentPinBitWidthPolicy with three variants: inferred, fixed (with calculateBitWidth), and configurable (with isSplittable).
  • Replaced the large switch in getComponentPinBitWidthStatus with a policy lookup via the new IntrinsicComponentDefinition.getPinAttributesByPinId / getByComponentId static accessors.
  • Each intrinsic in intrinsics/definitions.ts now declares an explicit bitWidthPolicy (e.g. display.Pixels derives its width from resolution.x * resolution.y).
  • defaultBitWidth is threaded through ComponentEvaluationContext and simulateComponent, so unfixed pins can fall back to the parent's resolved width instead of hard-coded 1.

Reconnect connections on bit-width change

  • In NodePinPropertyEditor, after a manual bit-width change, connections are re-evaluated: still-compatible ones are recreated instead of being silently dropped.

Reset button and default sample extraction

  • The default sample circuit setup was extracted from store/react/index.tsx into a new store/samples/default.ts (setupDefaultSample).
  • The home page's disabled "New File" button is removed in favor of a "Reset" button (with confirmation) that re-seeds the store with the default sample.
  • resetStore accepts an optional JSON payload; when omitted, the default sample is restored.

Auto-cleanup of orphaned nodes

  • CCNodeStore.mount now listens for components.willUnregister and unregisters nodes whose componentId or parentComponentId matches the removed component, preventing dangling references.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Apr 11, 2026

Deploying create-cpu-c8345196-9409-4cce-afc4-389f413ad8ee with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1df4159
Status: ✅  Deploy successful!
Preview URL: https://ee430b78.create-cpu-c8345196-9409-4cce-afc4-389f413ad8ee.pages.dev
Branch Preview URL: https://20260411.create-cpu-c8345196-9409-4cce-afc4-389f413ad8ee.pages.dev

View logs

chelproc and others added 2 commits May 4, 2026 17:17
Co-Authored-By: Rn86222 <84275482+Rn86222@users.noreply.github.com>
Co-Authored-By: taka231 <50023638+taka231@users.noreply.github.com>
Co-authored-by: Takashi Nagatomi <taka231@users.noreply.github.com>
Co-authored-by: Raito Nakajima <Rn86222@users.noreply.github.com>
@chelproc chelproc changed the title wip Add display rendering, time-stepped inputs, and pin bit-width policy refactor May 23, 2026
@chelproc chelproc marked this pull request as ready for review May 23, 2026 01:10
@chelproc chelproc merged commit 31cb374 into main May 23, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant